/*
 * ConfigProvider
 * 
 * Project: SSM
 * 
 * Copyright 2010 by HBASoft
 * All rights reserved.
 *
 * This software is the confidential and proprietary information
 * of HBASoft. ("Confidential Information"). You
 * shall not disclose such Confidential Information and shall
 * use it only in accordance with the terms of the license
 * agreements you entered into with HBASoft.
 */
package com.mimi.util;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.mimi.context.ContextProvider;


public class ConfigProvider {
    private static ConfigProvider configProvider;
    private static ApplicationContext appContext;

    public static ConfigProvider getInstance() {
        if (configProvider == null) {
            configProvider = new ConfigProvider();
        }
        return configProvider;
    }

    private ConfigProvider() {
        // DOMConfigurator.configure("log4j.xml");
        appContext = new ClassPathXmlApplicationContext("config/BeanLocations.xml");
    }

    public ApplicationContext getApplicationContext() {
        return appContext;
    }


    public DaoHelper getDaoHelper() {
        return (DaoHelper) appContext.getBean("daoHelper");
    }

    public ContextProvider getContextProvider() {
        return (ContextProvider) appContext.getBean("contextProvider");
    }
}
